class BDMelee_Torch extends BlackDeathMelee
        placeable;
		
	var PointLightComponent TorchLight;
	var ParticleSystemComponent FireEffect;
	var name TorchLightSocket;
	var bool bLit;
	
	//The (percentage) chance that the target will catch on fire
	var float IgnitePercent;

	
	simulated event PostBeginPlay()
	{
		super.PostBeginPlay();//Activate();
		SkeletalMeshComponent(Mesh).AttachComponentToSocket(TorchLight, TorchLightSocket);
		SkeletalMeshComponent(Mesh).AttachComponentToSocket(FireEffect, TorchLightSocket);
		bLit = false;
		ToggleLit(false);
	}
	
	simulated function ChangeVisibility(bool bIsVisible)
	{
		Super.ChangeVisibility(bIsVisible);
		if(FireEffect != none && bLit)
		{
			FireEffect.SetHidden(!bIsVisible);
		}
	}
	
	simulated state WeaponEquipping
	{

		simulated event BeginState(Name PreviousStateName)
		{
			Super.BeginState(PreviousStateName);
			ToggleLit(True);
		}
	}
	
	simulated function CustomFire()
	{
		local BlackDeathZombiePawn BDZP;
		local vector V;
		Super.CustomFire();
		SkeletalMeshComponent(Mesh).GetSocketWorldLocationAndRotation(TorchLightSocket, V);
		ForEach OverlappingActors(class'BlackDeathZombiePawn', BDZP, 200, V)
		{
			BDZP.RetreatFromFear(instigator);
		}
	}
	
	simulated state WeaponPuttingDown
	{
		simulated function WeaponIsDown()
		{
			Super.WeaponIsDown();
			ToggleLit(False);
		}
	}
	
	function simulated ToggleLit(bool bOn)
	{
		TorchLight.SetEnabled(bOn);
		if(!isHidden)
		{
			FireEffect.SetHidden(!bOn);
		}
		bLit = bOn;
	}
	
	simulated function doAttack(Pawn AttackedPawn, Vector HitLocation)//Do the actual hit to the thing
	{
		Super.doAttack(AttackedPawn, HitLocation);
		if(RandRange(0,1.0) < IgnitePercent)
		{
			BlackDeathPawn(AttackedPawn).Ignite();
		}
	}
	

DefaultProperties
{
	Begin Object Name=PickupMesh
		bOnlyOwnerSee=false
		CastShadow=false
		bForceDirectLightMap=true
		bCastDynamicShadow=false
		CollideActors=true
		BlockRigidBody=true
		MaxDrawDistance=6000
		bForceRefPose=1
		bUpdateSkelWhenNotRendered=false
		bIgnoreControllersWhenNotRendered=true
		bAcceptsStaticDecals=FALSE
		bAcceptsDynamicDecals=FALSE
		bAllowAmbientOcclusion=false
		SkeletalMesh=SkeletalMesh'BD_Weapon.mesh.Torch_Weapon'
	End Object
	DroppedPickupMesh=PickupMesh
	DroppedPickupClass=class'DroppedPickup'
	
	WeaponDamage = 5; //How much damage the weapon does
	HeavyWeaponDamage = 10;
	
	Begin Object Class=pointLightComponent Name=TorchComponent
		radius = 275.0
		FalloffExponent=10.000000
		Brightness=1.50000
		CastShadows=TRUE
		LightColor=(R=255,G=170,B=83)
	    CastStaticShadows=TRUE
	    CastDynamicShadows=TRUE
	    //bForceDynamicLight=FALSE
	    //UseDirectLightMap=FALSE
		//LightAffectsClassification=LAC_STATIC_AFFECTING
		//LightingChannels=(BSP=TRUE,Static=TRUE,Dynamic=FALSE,bInitialized=TRUE)
    End Object
	TorchLight = TorchComponent
	
	Begin Object Class=ParticleSystemComponent Name=FireEffectComponent
		bAutoActivate=TRUE
		Template=ParticleSystem'Victim_FX_01.Particles.LoopingFire'
		Scale3D=(X=0.062531,Y=0.062531,Z=0.062531)
		//Translation=(X=0.0,Y=0.0,Z=-44.0)
		SecondsBeforeInactive=1.0f
	End Object
	FireEffect=FireEffectComponent
	
	TorchLightSocket = TorchSocket

	AIRating=1.0
	
	WeaponEquipAnim=WeaponEquip
	FireAnim = VM_Stab
	MomentumScale = 10000;
	
	IgnitePercent = .33
	
	WeaponType = 3	
	
	Begin Object Name=WeaponMesh
		SkeletalMesh=SkeletalMesh'BD_Weapon.mesh.Torch_Weapon'
	End Object
	Mesh=WeaponMesh
}